package com.lw.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.lw.common.vo.BasePageQuery;
import com.mybatisflex.annotation.Column;
import com.mybatisflex.annotation.Id;
import com.mybatisflex.annotation.KeyType;
import com.mybatisflex.annotation.Table;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.List;


import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;

/**
 * 部门表 实体类。
 *
 * @author lw
 * @since 2025年05月15日 08:32:28
 */
@EqualsAndHashCode(callSuper = true)
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Schema(description = "部门表")
@Table("tb_dept")
public class TbDept extends BasePageQuery implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 主键
     */
    @Id(keyType = KeyType.Auto)
    @Schema(description = "主键")
    private Long id;

    /**
     * 部门名称
     */
    @Schema(description = "部门名称")
    private String name;

    /**
     * 部门编号
     */
    @Schema(description = "部门编号")
    private String code;

    /**
     * 父节点id
     */
    @Schema(description = "父节点id")
    private Long parentId;

    /**
     * 父节点id路径
     */
    @Schema(description = "父节点id路径")
    private String treePath;

    /**
     * 显示顺序
     */
    @Schema(description = "显示顺序")
    private Integer sort;

    /**
     * 状态(1-正常 0-禁用)
     */
    @Schema(description = "状态(1-正常 0-禁用)")
    private Integer status;

    /**
     * 创建人ID
     */
    @Schema(description = "创建人ID")
    private Long createBy;

    /**
     * 创建时间
     */
    @Schema(description = "创建时间")
    @Column(onInsertValue = "now()")
    private LocalDateTime createTime;

    /**
     * 修改人ID
     */
    @Schema(description = "修改人ID")
    private Long updateBy;

    /**
     * 更新时间
     */
    @Schema(description = "更新时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @Column(onUpdateValue = "now()")
    private LocalDateTime updateTime;

    /**
     * 逻辑删除标识(1-已删除 0-未删除)
     */
    @Schema(description = "逻辑删除标识(1-已删除 0-未删除)")
    private Integer isDeleted;

    @Schema(description = "子部门",hidden = true)
    @Column(ignore = true)
    private List<TbDept> children;

}
